package cn.wolfcode.luowowo.article.query;

import cn.wolfcode.luowowo.article.domain.Travel;
import cn.wolfcode.luowowo.common.query.QueryObject;
import com.sun.org.apache.bcel.internal.generic.RETURN;
import lombok.Getter;
import lombok.Setter;

@Setter
@Getter
public class TravelQuery extends QueryObject{

    private int dayType = -1; //天数范围

    private Long destId = -1L; //目的地
    private int orderType = 1; //排序
    private int travelTimeType = -1; //月份范围
    private int perExpendType = -1; //人均消费

    public String getOrderBy(){
        return orderType == 1? "t.createTime desc" : "t.viewnum desc";
    }

    //出行时间条件对象(出行天数范围)
    public TravelCondition getDays(){
        return TravelCondition.DAYS_MAP.get(dayType);
    }

    //月份范围
    public TravelCondition getTravelTime(){
        return TravelCondition.TRAVEL_TIME.get(travelTimeType);
    }

    //人均消费
    public TravelCondition getPerExpend(){
        return TravelCondition.TRAVEL_PRE_EXPENDS.get(perExpendType);
    }
}
